package my.hw;

import android.graphics.Point;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Grid {
	private Chess chess;
	private Point position; 
	private Button btn;
	private OnClickListener onclick;
	
	public Point getPosition(){
		return position;
	}
	
	public OnClickListener getOnClickListener(){
		return onclick;
	}
	
	public void setOnClickListener(OnClickListener value){
		this.onclick=value;
		btn.setOnClickListener(value);
	}

	public Chess getChess() {
		return chess;
	}

	public void setChess(Chess chess) {
		this.chess = chess;
		if(chess==null) { 
			btn.setText("");
		} else if(chess.getColor()==ChessColor.white) {
			btn.setText("○");
		} else if(chess.getColor()==ChessColor.black) {
			btn.setText("●");
		}
	}
	
	public Grid(Point position, View view){
		this.position=position;
		this.btn= (Button)view;
	}
	
}
